package com.ys.erp.stage_mall_service.bean.condition;

import com.ys.erp.framework.annotation.valid.MoneyValid;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;
import java.util.Map;

/**
 * @author lwj
 * @date 2025/5/28
 */
@Data
public class GoodsCondition {

    @Data
    @Accessors(chain = true)
    public static class AddOrUpGoodsCon {

        @Schema(description = "id")
        private Long id;

        @Schema(description = "实物商品 0 服务商品 1")
        private Integer goodsType;

        @Schema(description = "猫咪 0  小犬 1")
        private List<Integer> petType;

        @Schema(description = "是否展示 0否 1是")
        private Integer isUseTag;

        @Schema(description = "商品标签")
        private List<String> goodsTag;

        @Schema(description = "卡券id，非必填，实物商品不需要")
        private Integer cardCouponId;

        private Long categoryId;

        @Schema(description = "分类")
        @NotNull(message = "必须要有分类")
        private List<Long> categoryIdList;

        @Schema(description = "品牌id")
        private Long brandId;

        @Schema(description = "商品title")
        private String goodsTitle;

        @NotBlank(message = "商品名称不能为空")
        @Schema(description = "商品名称")
        private String goodsName;

        @NotNull(message = "商品图片不能为空")
        @Schema(description = "商品图片")
        private List<String> goodsBanner;

        @Schema(description = "商品视频")
        private String goodsVideo;

        @NotNull(message = "请选择是否上线")
        @Max(1)
        @Min(0)
        @Schema(description = "是否上线")
        private Integer isLine;

        @Schema(description = "是否自动发货")
        @NotNull(message = "请选择是否自动发货")
        @Max(1)
        @Min(0)
        private Integer isAutoSendGoods;

        @Schema(description = "总库存")
        private Long stockTotal;

        @Max(value = 100000, message = "最大值不能超过100000")
        @Schema(description = "商品排序")
        private Integer orderNum;

        @NotBlank(message = "商品金额不能为空")
        @MoneyValid
        @Schema(description = "商品价格")
        private String goodsPrice;

        @MoneyValid
        @Schema(description = "划线价")
        private String scribePrice;

        @MoneyValid
        @Schema(description = "幺币金额")
        private String ysMoney;

        @Schema(description = "幺币金额")
        private String ysMoneyDescribe;

        @Schema(description = "商品单位")
        private String goodsUnit;

        @Schema(description = "商品重量")
        private Integer goodsWeight;

        @Schema(description = "成本价格")
        private String costPrice;

        @Schema(description = "商品规格属性")
        private List<GoodsAttrCon> attrList;

        @Schema(description = "商品规格")
        private List<GoodsSpecsCon> specsConList;

        @Schema(description = "销量")
        private Integer saleNum;

        @NotNull
        @Schema(description = "是否限购")
        private Integer isQuota;

        @Schema(description = "限购数量")
        private Integer lifeQuotaNum;

        @Schema(description = "订单限购数量")
        private Integer orderQuotaNum;

        @Schema(description = "周期限购")
        private Map<String, String> cycleQuotaMap;

        @NotNull
        @Schema(description = "是否显示购买权限")
        private Integer isShowBuyRight;

        @Schema(description = "显示等级id集")
        private List<Long> showGradeIdList;

        @Schema(description = "等级限购")
        private List<Long> quotaGradeIdList;

        @Schema(description = "领猫日期多少天")
        private Integer adoptCatDays;

        @Schema(description = "运费模板id")
        private Long freightId;

        @Schema(description = "是否包邮")
        private Integer isCost;

        @Schema(description = "包邮id")
        private Long costId;

        @Schema(description = "分享标题")
        private String shareTitle;

        @Schema(description = "分享图片")
        private String sharePic;

        @Schema(description = "商品详情")
        private String goodsDetail;

        @Schema(description = "城市名称 所有用户均可访问传 []")
        private List<String> cityNameList;

        @Schema(description = "是否复购可见 0否 1是 ")
        private Integer isRepeat;

        @Schema(description = "领猫日期多少天可浏览")
        private Integer adoptCatDaysView;

    }

    @Data
    @Accessors(chain = true)
    public static class GoodsSpecsCon {

        @Schema(description = "规格id")
        private Long id;

        @Schema(description = "规格图片")
        private String pic;

        @Schema(description = "规格重量")
        private Integer specsWeight;

        @Schema(description = "规格属性")
        private List<SpecsCon> attrMap;

        @Schema(description = "规格价格")
        private String specsPrice;

        @Schema(description = "规格库存")
        private Integer stock;

        @Schema(description = "运费")
        private Long deliveryCost;

        @Schema(description = " jst重量")
        private Integer jstWeight;

        @Schema(description = "规格成本价")
        private String specsCostPrice;

        @Schema(description = "幺币抵扣")
        private Integer ysCoinDiscount;

        @Schema(description = "发货方式，NORMAL:正常发货,ONLY_NO_SEND：单拍不发")
        private String sendGoodsType;

    }

    @Data
    @Schema(description = "规格请求对象")
    public static class SpecsCon {

        @Schema(description = "规格属性")
        private String key;

        @Schema(description = "规格属性值")
        private String value;

        @Schema(description = "卡卷")
        private List<CardGoodsCon> card;

    }

    @Data
    @Accessors(chain = true)
    public static class CardGoodsCon {

        @Schema(description = "卡卷id")
        private Long cardId;

        @Schema(description = "卡卷名称")
        private String cardName;

        @Schema(description = "发放卡卷数量")
        private Integer cardNum;

    }

    @Data
    @Accessors(chain = true)
    public static class GoodsAttrCon {

        @Schema(description = "卡卷属性key")
        private String key;

        @Schema(description = "卡卷属性values")
        private List<GoodsAttrValuesCon> values;

        @Schema(description = "卡卷")
        private List<CardGoodsCon> card;

    }

    @Data
    @Accessors(chain = true)
    public static class GoodsAttrValuesCon {

        @Schema(description = "属性值")
        private String value;

    }

    @Data
    @Accessors(chain = true)
    @Schema(description = "商品分页查询条件")
    public static class PageGoodsCon {

        @Schema(description = "当前页码")
        private Integer current = 1;

        @Schema(description = "每页大小")
        private Integer size = 10;

        @Schema(description = "商品名称")
        private String goodsName;

        @Schema(description = "分类id")
        private Long categoryId;

        @Schema(description = "分类id列表")
        private List<Long> categoryIdList;

        @Schema(description = "品牌id")
        private Long brandId;

        @Schema(description = "是否上线")
        private Integer isLine;

        @Schema(description = "商品类型")
        private Integer goodsType;

        @Schema(description = "0幺币商品，1现金")
        private Integer isCash;

        @Schema(description = "发货方式，NORMAL:正常发货,ONLY_NO_SEND：单拍不发")
        private String sendGoodsType;

        @Schema(description = "排序方式")
        private Integer isOrderDesc;

        @Schema(description = "价格排序")
        private Integer isPriceDesc;

        @Schema(description = "库存排序")
        private Integer isStockDesc;

        @Schema(description = "查询方式 0为其他查询  1为聚合区活动区金刚区商品查询")
        private Integer queryType;
    }

}
